package com.java.study.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * @author jiangli
 * @date 2019/9/27 20:37
 */
@Configuration
@Data
public class WechatConfig {
	/**
	 * 微信公众号appid
	 */
	@Value("${wxpay.appid}")
	private String appid;
	/**
	 * 微信公众号秘钥
	 */
	@Value("${wxpay.appsecret}")
	private String appsecret;
	/**
	 * 开发平台appid
	 */
	@Value("${wxopen.appid}")
	private String openAppid;
	/**
	 * 开发平台秘钥
	 */
	@Value("${wxopen.appsecret}")
	private String openAppsecret;
	/**
	 * 微信开放平台回调url
	 */
	@Value("${wxopen.redirect_url}")
	private String openRedirectUrl;
	/**
	 * 微信开放平台二维码连接
	 */
	public static final String OPEN_QRCODE_URL= "https://open.weixin.qq.com/connect/qrconnect?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_login&state=%s#wechat_redirect";
	/**
	 * 开放平台获取access_token地址
	 */
	public static final String OPEN_ACCESS_TOKEN_URL= "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code";
	/**
	 * 获取用户信息
	 */
	public static final String OPEN_USER_INFO_URL ="https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=zh_CN";
	/**
	 * 商户号id
	 */
	@Value("${wxpay.mer_id}")
	private String mchId;
	/**
	 * 支付key
	 */
	@Value("${wxpay.key}")
	private String key;
	/**
	 * 微信支付回调url
	 */
	@Value("${wxpay.callback}")
	private String payCallbackUrl;
	/**
	 * 统一下单url
	 */
	public static final String UNIFIED_ORDER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";

}
